#include <iostream>
#include <string>
using namespace std;

class Solution 
{
public:
    bool isAnagram(string s, string t) 
    {
        int record[26] = {0};
        if(s.size() != t.size())
        {
            return false;
        }
        for(int i = 0; i < s.size(); i++)
        {
            record[s[i]-'a']++;
            record[t[i]-'a']--;
        }
        for (int i = 0; i < 26; i++)
        {
            if(record[i] != 0)
            {
                return false;
            }
        }
        return true;
    }
};

int main() 
{
    Solution solution;
    // 测试用例1：是字母异位词
    string s1 = "anagram";
    string t1 = "nagaram";
    cout << "测试1: " << (solution.isAnagram(s1, t1) ? "true" : "false") << endl; // 应输出true

    // 测试用例2：不是字母异位词
    string s2 = "rat";
    string t2 = "car";
    cout << "测试2: " << (solution.isAnagram(s2, t2) ? "true" : "false") << endl; // 应输出false

    // 测试用例3：空字符串
    string s3 = "";
    string t3 = "";
    cout << "测试3: " << (solution.isAnagram(s3, t3) ? "true" : "false") << endl; // 应输出true

    // 测试用例4：长度不同
    string s4 = "a";
    string t4 = "ab";
    cout << "测试4: " << (solution.isAnagram(s4, t4) ? "true" : "false") << endl; // 应输出false

    // 测试用例5：包含重复字母
    string s5 = "aabbcc";
    string t5 = "baccab";
    cout << "测试5: " << (solution.isAnagram(s5, t5) ? "true" : "false") << endl; // 应输出true

    return 0;
}
